package com.park.controller;

import com.park.platform.service.IBannerService;
import com.park.platform.service.IHomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("home")
public class HomeController extends BaseController {

    @Autowired
    private IHomeService homeService;

    @Autowired
    private IBannerService bannerService;

    @RequestMapping("index")
    public String getArticles(Model model){
        try{
            model.addAllAttributes(homeService.getIndex());
            model.addAllAttributes(bannerService.getBanners());
        }catch (Exception e){
            e.printStackTrace();
        }
        return "index";
    }

}
